﻿@using ECG.Common
@using ECG.WebUI.CustomHelpers
@model ViewProductDetailDto
@{
    ViewBag.Title =  Model.Name;
    ViewBag.Description = string.IsNullOrEmpty(Model.MetaDescription) ? Model.Name : Model.MetaDescription;
    Layout = "~/Views/Shared/_LayoutHideCate.cshtml";
    //var pricePromotion = Model.GetPricePromotion();
    var productStatus = string.Empty;
    var sizeList = (List<ProductSizeListByPidDto>) ViewBag.SizeList;
    var url = FunctionHelpers.GetFullUrl();
    switch (Model.ProductStatus)
    {
        case "conhang":
            productStatus = "Còn hàng";
            break;
        case "goihang":
            productStatus = "Gọi hàng"; break;
        case "hethang":
            productStatus = "Hết hàng"; break;
        default:
            productStatus = "Còn hàng";
            break;
    }
}
<link href="~/Scripts/CloudZoom/cloud-zoom.css" rel="stylesheet" />
<div class="bb_pdetail">
<div id="fb-root"></div>


    @Html.Action("DirectionCategory", "Category", new { categoryId = ViewBag.CateId })
    
    @using(Html.BeginForm("Index", "ProductDetail", FormMethod.Post))
    {
        <div class="p-info-price">
            @Html.Hidden("productId", Model.Id )
            @Html.Hidden("productBarcode", Model.Barcode)
            @Html.Hidden("productStatus", Model.ProductStatus)
            @Html.Hidden("rootPriceProduct",  Model.Price)
            @Html.Hidden("promotionPrice", Model.PromotionPrice)
            <input type="hidden" name="productName" id ="productName" value="@Model.Name" />
            @Html.Hidden("productColor")
            @Html.Hidden("productColorCode")
            @Html.Hidden("productSizeId")
            @Html.Hidden("productSizeName")
            @Html.Hidden("productSizePrice")
            @Html.Hidden("productImagePath", Model.ImagePath)
            @Html.Hidden("promotionPercent", Model.DiscountPercentage)
            @Html.Hidden("decreasePrice", Model.DiscountAmount)
            @Html.Hidden("providerName", Model.ProviderName)
            @Html.Hidden("categoryId", Model.CategoryId)
            @Html.Hidden("categoryName", Model.CategoryName)
        
            <div class="p-short-info fl-l">
                <div class="p-img-sl fl-l">
                    @Html.Action("ProductImageDetail", "ProductDetail", new { productId = Model.Id })
				
                    @if (sizeList.Any())
                    {
                        var itemFirstSize = sizeList.FirstOrDefault();
                        <div class="p-size">
                            <span class="cl-orange">KÍCH CỠ</span>
                            @if(itemFirstSize != null)
                            {
                                var sizePromotionPrice = Model.GetPricePromotionBySizePrice(itemFirstSize.SizePrice);
                                <a rel="noffolow" href="javascript:void(0);" title="@itemFirstSize.SizeName" sizePromotionPriceShow="@sizePromotionPrice.ToString("#,###")" sizePriceShow ="@itemFirstSize.SizePrice.ToString("#,###")" sizePromotionPrice="@sizePromotionPrice" class="p-size-item p-size-selected" sizeId="@itemFirstSize.SizeId" sizePrice="@itemFirstSize.SizePrice">@itemFirstSize.Code</a>
                            }
                            @foreach (var item in sizeList.Where(item => item != sizeList.First()))
                            {
                                var sizePromotionPrice = Model.GetPricePromotionBySizePrice(item.SizePrice);
                                <a rel="noffolow" href="javascript:void(0);" title="@item.SizeName" sizePromotionPriceShow="@sizePromotionPrice.ToString("#,###")" sizePriceShow ="@item.SizePrice.ToString("#,###")" sizePromotionPrice="@sizePromotionPrice" class="p-size-item" sizeId="@item.SizeId" sizePrice="@item.SizePrice">@item.Code</a>
                            }
                        </div>
                    }
                </div>
			
                <div class="p-d-info fl-r">
                    <h1>@Model.Name</h1>
                    <div class="p-like-people">
                        <img src="/images/star-4.png" alt=""/>
                        <span class="p-count-view fl-l"><span class="icon-view"></span>@string.Format("{0}", Model.TotalView < 0 ? 0 : Model.TotalView)</span>
                        <div class="fb-like" data-href="@url" data-send="false" data-layout="button_count" data-width="400" data-show-faces="false"></div>
                        @*<span class="p-count-buy fl-l"><span class="icon-cbuy"></span>123.412</span>*@
                        @*<span class="p-like-face fl-l"><span class="icon-face "></span></span>
                    <span class="p-like-twitter fl-l"><span class="icon-twi"></span></span>
                    <span class="p-like-google fl-l"><span class="icon-google"></span></span>*@
                        <div class="clr"></div>
                    </div>
                    <div class="p-barcode pd-t-b-5">
                        <span>Mã sản phẩm: </span> <strong>@Model.Barcode</strong>
                    </div>
                    <div class="p-barcode pd-t-b-5">
                        <span>Số lượng: </span>
                        <select name="productQuantity" style="width: 38px;">
                            <option>1</option>
                            <option>2</option>
                            <option>3</option>
                            <option>4</option>
                            <option>5</option>
                        </select>
                    </div>
                    <div class="p-technical">
                        @if(!string.IsNullOrEmpty(Model.CustomInfoFirst))
                        {
                            <p><span class="icon-stick"></span>@Model.CustomInfoFirst</p>
                        }
                        @if(!string.IsNullOrEmpty(Model.CustomInfoSecond))
                        {
                            <p><span class="icon-stick"></span>@Model.CustomInfoSecond</p>
                        }
                        @if(!string.IsNullOrEmpty(Model.CustomInfoThird))
                        {
                            <p><span class="icon-stick"></span>@Model.CustomInfoThird</p>
                        }
                    </div>
                    @*<div class="p-child">
					<h3><span class="icon-box"></span>BỘ SẢN PHẨM BAO GỒM</h3>
					<p>
						<span class="cl-yellow">01</span> Velit ese cillum dolore eu fugiat nulla pariatur.
					</p>
					<p>
						<span class="cl-yellow">01</span> Velit ese cillum dolore eu fugiat nulla pariatur.
					</p>
					<p>
						<span class="cl-yellow">01</span> Velit ese cillum dolore eu fugiat nulla pariatur.
					</p>
				</div>*@
                    @if (Model.PromotionPrice > 0)
                    {
                        <div class="p-promotion-info">
                            <h3><span class="icon-promotion"></span>KHUYẾN MẠI</h3>
                            <p>@Model.DiscountInfo</p>
                        </div>
                    }
                
                </div>
                <div class="clr"></div>
            </div> <!-- END .p-short-info -->
		
            <div class="p-price-order fl-r">
                <div class="box-price-order">
                    <div class="b-p-title">THANH TOÁN</div>
                    @if (Model.PromotionPrice <= 0)
                    {
                        if (sizeList.Any())
                        {
                            <div class="bp-box-price">
                                <p class="p-price">@sizeList.First().SizePrice.ToString("#,###")</p>
                                <p class="bpb-last">VNĐ</p>
                            </div>
                        }
                        else
                        {
                            <div class="bp-box-price">
                                <p class="p-price">@Model.Price.ToString("#,###")</p>
                                <p class="bpb-last">VNĐ</p>
                            </div>
                        }
                    }
                    else
                    {
                        if (sizeList.Any())
                        {
                            <div class="bp-box-price">
                                <p class="p-root-price">@sizeList.First().SizePrice.ToString("#,###") VNĐ</p>
                                <p class="p-price">@Model.GetPricePromotionBySizePrice(@sizeList.First().SizePrice).ToString("#,###")</p>
                                <p class="bpb-last">VNĐ</p>
                            </div>
                        }
                        else
                        {
                            <div class="bp-box-price">
                                <p class="p-root-price">@Model.Price.ToString("#,###") VNĐ</p>
                                <p class="p-price">@Model.PromotionPrice.ToString("#,###")</p>
                                <p class="bpb-last">VNĐ</p>
                            </div>
                        }

                    }
				
                    <div class="p-status">
                        <div class="icon-pstatus"></div>
                        <span>@productStatus</span>
                    </div>
                    @if (Model.PromotionPrice > 0)
                    {
                        <div class="p-status">
                            <div class="icon-psave"></div>
                            <span>TIẾT KIỆM <span>@Model.DiscountPercentage.ToString("##") %</span></span>
                        </div>
                    }
                    <div class="p-status ps-alone">
                        <div class="icon-ptranform"></div>
                        <div class="ps-second">
                            <span>Giao hàng tận nơi:</span>
                            <span class="fo-bold">Chi tiết</span>
                        </div>
                    </div>
                    <div class="p-status ps-sub-box">
                        <div>
                            <div class="icon-order"></div>
                            @if(!Model.ProductStatus.Equals("hethang"))
                            {
                                <input type="submit" value="LẬP TỨC THANH TOÁN" />
                            }
                            
                        </div>
                    </div>
                </div> <!-- END .box-price-order -->
			
                <div class="box-sf">
                    <div>
                        <div class="icon-share-friend"></div>
                        <a href="javascript:void(0);" rel="noffolow">Gửi cho bạn bè</a>
                    </div>
                    <div>
                        <div class="icon-add-p"></div>
                        <a href="javascript:void(0);" rel="noffolow">Thêm vào danh sách mong muốn</a>
                    </div>
                    <div class="bsf-last">
                        <div class="icon-support-online"></div>
                        <a href="javascript:void(0);" rel="noffolow">Hỗ trợ trực tuyến</a>
                    </div>
                </div> <!-- END BOX Share friends, like, Support Online -->
            </div>
            <div class="clr"></div>
        </div> <!-- END .p-info-price -->
    }

    <div class="p-info-detail">
        <div class="pi-p-des fl-l">
            <div class="pi-p-title">
                <h2><span>CHI TIẾT SẢN PHẨM</span></h2>
                <div class="pip-content">
                    @Html.Raw(Model.Description)
                </div>
            </div>
        </div>
		
        <div class="p-rela-suggest fl-r">
            <div class="prs-content">
                @Html.Action("ProductConcern", new { categoryId = ViewBag.CateId })
            </div>
        </div>
		
        <div class="clr"></div>

        @Html.Action("TagsByProduct", new { productId = Model.Id })
        <!-- END Tag list by product -->

    </div> <!-- END .p-info-detail -->
	
	
</div>
@section scripts
{

    @Scripts.Render("~/bundles/productDetail")
}
